package com.company;

import com.company.service.AddClass;
import com.company.service.SubClass;

public class Task2 {

    public static int i = 0;

    public static void main(String[] args) {
        //todo 2. 设计3个线程，其中2个线程对数字index进行 +1 操作，另外一个线程进行 -1 操作，要求线程安全
        AddClass add = new AddClass();
        AddClass add2 = new AddClass();
        SubClass sub = new SubClass();
        Thread thread1 = new Thread(add);
        Thread thread2 = new Thread(add2);
        Thread thread3 = new Thread(sub);
        thread1.start();
        thread2.start();
        thread3.start();

    }
}
